/* c5.c
 *	Simple program to help perform multi-client test using networking to implement lock/cv/mv-related syscalls
 *	
 *	Does syscalls that create, acquire, release, and destroy locks and create, wait, signal, broadcast, and destory CVs, create, set, get, destory MVs
 *  through connection to a server. Will be used with one single-threaded server process and up to 5 single-threaded client processes.
 */
#include "syscall.h"

int main(int argc, char **argv)
{   
	int i;
	for(i=0;i<10000; i++)
	{
		Yield(0); /*Wait for clients to set monitor variables*/
	}

	/*if(GetMV(0) == 1) /*If Client1 is waiting*/
	/*{*/
		/*Wake up Client 1*/
	Acquire(10);
	Broadcast(10,10);
	Release(10);
	/*}*/
	/*if(GetMV(1) == 1) /*If Client2 is waiting*/
	/*{*/
		/*Wake up Client 2*/
		/*Signal(1,1);*/
	/*}
	if(GetMV(2) == 1) /*If Client3 is waiting*/
	/*{*/
		/*Wake up Client 3*/
		/*Signal(2,2);*/
	/*}*/

	/*for(i=0;i<3; i++)
	{
		DestroyLock(i);
		DestroyCV(i);
		DestroyMV(i);
	}*/
	/*if(GetMV(3) == 1)*/ /*If Client4 is waiting*/
	/*{*/
		/*Wake up Client 4*/
		/*Signal(3,3);
	}*/
	
	/* Then we're done!*/ 
    Halt(); /*MUST do since using networking (post office has own thread)*/
}
